Method and system for generating executable code for formatting and printing complex data structures

ABSTRACT

The present invention provides a complier and linker for analyzing the structures of complex data stored in memory when a print statement specified in source code refers to those complex data structures, and then generating executable code which will print the complex data when a data processing system executes the executable code.

BACKGROUND

[0001] It is desirable to be able to view data object structures for avariety of reasons. Most C/C++ based software products have aconsiderable number of complex data types including ‘union’, ‘structure’or ‘classes’ that consists of one or more native types and possiblyother complex data types. Many of the data types for a large softwareproduct are complex and they are not native. Native by definition areall the data types any existing compiler recognizes, commonly, but notlimited to numbers, characters, dates, times, etc. Complex data type isa combination of native types and other complex types. For example aperson's mailing address may be a combination of house number, street,city, country, postal/zip code. Each of these is a native type (numberand list of characters). Surprisingly, there is no easy way to formatthese complex data types into a form that is easily readable by programdevelopers thus enabling them to more easily and quickly diagnoseproblems in the source code they are developing. Currently, codedevelopers are experiencing a very difficult task of determining how todisplay or otherwise output this complex information (contained in thecomplex data types) in a human readable form for troubleshooting sourcecode during code development. In particular, the complex data types arenot predefined and are therefore the software products have difficultiesin supporting printing formats of the data.

[0002] Some known methods for resolving this problem include:

[0003] a) manually formatting complex data types,

[0004] b) using a debugger, or

[0005] c) some form of post compilation method.

[0006] A common practice for developers or service analysts is tomanually format raw memory (usually in hexadecimal form) into a morehuman readable format. This manual process is error prone and requiresintimate knowledge of the fields in the data structures (or classes),sizes, alignment, byte order, hardware architecture, etc., requiringmuch time and thus incurring unwanted cost.

[0007] As a result, much time is spent formatting the informationrelated to the complex data. For example, using the mailing addressabove, to format manually you will need to study the complex datastructure and from that determine where the house number ends and thestreet name begins. Then where the street name ends and the city namestarts, analysis is continued this way for all fields in the complexdata type. If you miscalculate a beginning or ending location youranalysis will be error prone and result in wasted time and effort untilthe mistake is realized and the calculation corrected.

[0008] Additionally, using a debugger to format complex data typesrequires a software product to be built with extra debug information.This results in larger and slower programs possibly affecting the natureof the problem. A debugger may not be available on a customer's machineand customer may not want to purchase one. Debuggers often incursignificant overhead in load on a system and slow down the normalexecution of a program. This slowdown could drastically affect theoccurrence of the problem, thus making it difficult to reproduce andsolve.

[0009] Another solution is for the program developer to write customprogram logic to print complex data types without relying on a compilerto generate the code for printing. The problem here is additional workplaced on the program developer, and more importantly, should thecomplex data type ever change by the addition or removal of a field,then the program developers needs to remember to update their customwritten print logic to handle the addition or removal. This is veryerror prone and possibly time consuming depending on the amount ofchange.

[0010] Post compilation methods are also not well suited for loggingerror messages with complex data types, and these methods require extracomplexity in the development environment.

[0011] Known debuggers may provide a function for printing complex datastructures. Known debuggers also display memory in a formatted form,variable by variable, structure by structure, and they allow theexpanding of structures and arrays to see contents and nestedstructures. An example of this is the IBM Distributed Debugger product.The disadvantage provided by known debuggers is that they are suppliedas a separate product, and they operate independently of the softwareprogram product that requires debugging. A debugger provides a verycomplicated solution. What is needed is a simple solution that does notrequire other programs (that is debuggers) to be operating while thesoftware that requires debugging operates. Known debuggers require avery large learning curve. They also require the computer program beingdebugged to be active and executing while the debugger is active. Thedebugger requires debuggable code, whereas most production environmentsrequire highly optimized code for performance as well as sizerequirements. Known debuggers interact with running programs, and thusaffecting performance which may affect the timing within the program andthus affect the problem occurrence.

[0012] Accordingly, a solution that addresses, at least in part, thisand other shortcomings is desired.

SUMMARY

[0013] It is an object of the present invention to provide a system,computer program product, network downloadable code, and a method forgenerating code for formatting and printing complex data structures.

[0014] Advantageously, the present invention requires the compiler andthe linker to set up the executable program. The executable program (theprogram to be fixed) runs on its own without having to have any otherprogram (like a debugger) run along side of the executable program to befixed.

[0015] In an embodiment of the present invention, there is provided acompiler for compiling source code into object code, the source codeincluding a print command, the print command for abstracted printing ofa complex data structure accessible by the compiler, the object codeincluding code for directing a data processing system to print thecomplex data structure, the compiler including: an identifier module forrecognizing the print command in the source code,

[0016] a type module for identifying the complex data structure of theprint command from a set of user-defined data types, a format module forformatting output settings of the complex data structure, the outputsettings dependent upon at least one print parameter associated with theprint command, and wherein the results of the modules are adapted todefine the object code with an embedded print command.

[0017] In another embodiment of the present invention, there is provideda computer program product having a computer-readable medium tangiblyembodying computer readable instructions for directing a compileroperable in a data processing system to compile source code into objectcode, the source code including a print command, the print command forabstracted printing of a complex data structure accessible by thecompiler, the object code including code for directing a data processingsystem to print the complex data structure, the computer program productincluding: computer readable code for implementing an identifier modulefor recognizing the print command in the source code, computer readablecode for implementing a type module for identifying the complex datastructure of the print command from a set of user-defined data types,computer readable code for implementing a format module for formattingoutput settings of the complex data structure, the output settingsdependent upon at least one print parameter associated with the printcommand, and wherein the results of the modules are adapted to definethe object code with an embedded print command.

[0018] In yet another embodiment of the present invention, there isprovided an article including: a computer-readable signal-bearing mediumbeing uploadable and downloadable on a network, and means in the mediumfor directing a data processing system to execute a compiler forcompiling source code into object code, the source code including aprint command, the print command for abstracted printing of a complexdata structure accessible by the compiler, the object code includingcode for directing a data processing system to print the complex datastructure, the means in the medium including: means in the medium forimplementing an identifier module for recognizing the print command inthe source code, means in the medium for implementing a type module foridentifying the complex data structure of the print command from a setof user-defined data types, means in the medium for implementing aformat module for formatting output settings of the complex datastructure, the output settings dependent upon at least one printparameter associated with the print command, and wherein the results ofthe modules are adapted to define the object code with an embedded printcommand.

[0019] In yet another embodiment of the present invention, there isprovided a linker for linking components of an object code to produce anexecutable code, some components of the object code adapted to have anindividual copy of a printing object for printing a complex datastructure, the linker including: an identifier module for recognizing atleast one of the object components having an embedded print commandcorresponding to the individual printing object, the embedded printcommand for abstracted printing of the complex data structure, a comparemodule for comparing two or more identified embedded print commands fromthe object components, the comparison for determining whether two ormore of the identified embedded print commands are identical copies ofthe individual printing object, and wherein the results of the modulesare adapted to define the executable code with at least one executableprint command corresponding to the embedded print command.

[0020] In yet another embodiment of the present invention, there isprovided a computer program product having a computer-readable mediumtangibly embodying computer readable code for directing a dataprocessing system to implement a linker for linking components of anobject code to produce an executable code, some components of the objectcode adapted to have an individual copy of a printing object forprinting a complex data structure, the computer program productincluding: computer readable code for implementing an identifier modulefor recognizing at least one of the object components having an embeddedprint command corresponding to the individual printing object, theembedded print command for abstracted printing of the complex datastructure, computer readable code for implementing a compare module forcomparing two or more identified embedded print commands from the objectcomponents, the comparison for determining whether two or more of theidentified embedded print commands are identical copies of theindividual printing object, and wherein the results of the modules areadapted to define the executable code with at least one executable printcommand corresponding to the embedded print command.

[0021] In yet another embodiment of the present invention, there isprovided an article having a computer-readable signal-bearing mediumbeing uploadable and downloadable on a network, and means in the mediumfor directing a data processing system to implement a linker for linkingcomponents of an object code to produce an executable code, somecomponents of the object code adapted to have an individual copy of aprinting object for printing a complex data structure, the means in themedium including: means in the medium for implementing an identifiermodule for recognizing at least one of the object components having anembedded print command corresponding to the individual printing object,the embedded print command for abstracted printing of the complex datastructure, means in the medium for implementing a compare module forcomparing two or more identified embedded print commands from the objectcomponents, the comparison for determining whether two or more of theidentified embedded print commands are identical copies of theindividual printing object, and wherein the results of the modules areadapted to define the executable code with at least one executable printcommand corresponding to the embedded print command.

[0022] In yet another embodiment of the present invention, there isprovided a computer program product having a medium tangibly embodyingcomputer readable code for implementing a print function for directing acompiler to generate an embedded print command in an object code fordirecting a data processing system to print a complex data structureidentified by the print function, the print function for use in sourcecode, the computer program product including: computer readable code forimplementing a buffer parameter for identifying the buffer to receivethe complex data structure selected from a set of user-defined datatypes, computer readable code for implementing a size parameter forlimiting the size of the buffer, computer readable code for implementinga type parameter that is internal to the compiler, the type parameterfor accepting complex data types corresponding to the complex datastructure, computer readable code for implementing an output parameterfor representing the output settings of the complex data structure, andwherein an executable version of the embedded print command is used bythe data processing system for abstracted printing of the complex datastructure.

[0023] In yet another embodiment of the present invention, there isprovided an article including: a computer-readable signal-bearing mediumbeing uploadable and downloadable over a network, and means in themedium for directing a data processing system to implement a printfunction for directing a compiler to generate an embedded print commandin an object code for directing a data processing system to print acomplex data structure identified by the print function, the printfunction for use in source code, the means in the medium including:means in the medium for implementing a buffer parameter for identifyingthe buffer to receive the complex data structure selected from a set ofuser-defined data types, means in the medium for implementing a sizeparameter for limiting the size of the buffer, means in the medium forimplementing a type parameter that is internal to the compiler, the typeparameter for accepting complex data types corresponding to the complexdata structure, means in the medium for implementing an output parameterfor representing the output settings of the complex data structure, andwherein an executable version of the embedded print command is used bythe data processing system for abstracted printing of the complex datastructure.

[0024] These and other features of the preferred embodiments of theinvention will become more apparent in the following detaileddescription in which reference is made to the appended drawings by wayof example only, in which:

[0025]FIG. 1 is a schematic diagram of a data processing system;

[0026]FIG. 2 is a diagram of a compiler of the system of FIG. 1;

[0027]FIG. 3 is a diagram of a linker of the system of FIG. 1;

[0028]FIG. 4 is a flowchart of the operation of the compiler of FIG. 2;and

[0029]FIG. 5 is a flowchart of the operation of the linker of FIG. 3.

[0030] Similar references are used in different figures to denotesimilar components.

DETAILED DESCRIPTION

[0031] The following detailed description of the embodiments of thepresent invention does not limit the implementation of the invention toany particular computer programming language. The present invention maybe implemented in any computer programming language provided that the OS(Operating System) provides the facilities that may support therequirements of the present invention. A preferred embodiment isimplemented in the C or C++ computer programming language (or othercomputer programming languages in conjunction with C/C++). Anylimitations presented would be a result of a particular type ofoperating system or computer programming language and would not be alimitation of the present invention.

[0032] A compiler is adapted to generate (on the fly) a function to‘print’ a particular structure or data type, while parsing the sourcecode. The embedded print functions can be used by a developer to view orotherwise output complex data object structures. The printing/outputtingof the structure/data type can include such as but not limited todisplaying the information on a computer screen, displaying theinformation on a hard copy (paper, etc

, and/or storing the information in a file for later retrieval andviewing. It is recognized that data structures/types can be such as butnot limited to data objects, which are groupings of data items calledattributes. Further, the set of attributes and corresponding values makeup an instance of the data object, such as but not limited to a databasetable where columns are attributes and rows are instances.

[0033] The following is an example of a print function 10 (see FIG. 1)(for example in the C or C++ language) or command that may be insertedor included in the source code (that is, My Program) for generatingdisplay information of the data structure/type:

[0034] size_t cprintf (void *buf, size_t bsize, _ctype_val, int opts,int slen)

[0035] Referring to FIG. 1, the print function or the command 10 directsa data processing system 100 to print (or otherwise view) a complex datastructure 12, once a source code 14 has been compiled and linked togenerate executable code 16 which will direct the data processing system100 to print the complex data structure 12 on an output device 18, suchas but not limited to a computer display, a printer, and/or a storedfile for subsequent review. The complex data structure 12 may include,but are not limited to strings of text, numbers, dates, times, binaryinformation such as pictures, sound, video, etc. For example, this printfunction 10 will be read by a compiler 20, which subsequently producesan object code 22 including a print command 24 to print the complex datastructure 12 identified in the print command 10.

[0036] The following describes the variables, parameters, and/or optionsincluded in the example print function, command or statement 10, namelycprintf.

[0037] cprintf This is the function 10 that prints to the buffer ‘buf’that has a maximum size of ‘bsize’. The function 10 prints a variable‘val’ of type‘_ctype_’. The ‘cprintf’ function and ‘_ctype_’ may both beimplemented internally in the compiler 20, and may be reserved words.‘ctype’ means complex data type 12. In a default case, the ‘void *buf’can be a ‘char *buf’.

[0038] The cprintf function 10 may format the complex data structure 12,or more basic type such as string, into a human readable form for outputto the output device 18, such as but not limited to a similar outputformat typically produced by a debugger. For example an address could bestored in a binary format, such as ‘7B414E89535452454554’ which convertsto ‘123 ANYSTREET’. ‘7B’ is the hexadecimal value of 123, and theremainder being the hexadecimal value of ‘ANYSTREET’. It is assumed thislatter text format is easier to check for validity.

[0039] Parameter Ctype

[0040] This is a compiler front end internal type that accepts any datatype. This includes native types such as ‘int’, ‘float’ or complex datatypes such as structures, classes or unions, as well as arbitrary datasuch as but not limited to pictures and text strings.

[0041] Parameter Opts

[0042] The following options may be included in opts field as flags todefine the operation of the print function 10 cprintf. The options mayinclude:

[0043] Option A. A Default Return buffer

[0044] The default returned buffer is a delimited list of stringscontaining the information where each field within a single data type isalso delimited. An example output buffer is shown below. Actual buffercontent delimiters can vary. This is just one sample. This example usesa tab delimiter (t) character, with NULL (\0) as end of returned bufferdelimiter.

[0045] Field1_name \t field1_type \t field1_length \t field1_value \tfield1_offset \t field2_name \t field2_type \t field2_length \tfield2_value \t field2_offset \0

[0046] An additional option can be defined for changing the returninformation to be a pointer to an area of memory the print function 10has allocated which contains a linked list structure of data type 12information. If this option is set then bsize is expected to be themaximum number of levels of recursion allowed, and buf is a location tostore the returned structure pointer. In this case the calling functionis responsible for freeing each structure in the linked list.

[0047] Option B.

[0048] An option for including the offsets of fields or structuremembers of the complex data structure 12 is placed in the returnedbuffer. The returned buffer is defined above by example.

[0049] Option C.

[0050] An option includes placing the size of each field or structuremember of the complex data structure 12 in the returned buffer.

[0051] Option D.

[0052] An option to include any pads that might have been included foralignment purposes in the returned buffer. A pad is space allocated inthe buffer to force the fields of the complex data type to align as thecompiler 20 wants them to. Including pads can make it easier for aprogram developer to determine the start and end of each field foreventual viewing on the output device 18.

[0053] Option E.

[0054] This option identifies the method of printing nested complex datatypes 12 either via a loop of program code or recursively callingcprintf for each non-native structure within the complex data structure.(i.e. not for a char or an integer, native types). Nesting means thatthe complex data type 12 is included inside another complex data type12. For example an employee complex data type 12 would include the homeaddress complex data type 12, as well as the work address complex datatype 12, the salary/benefits complex data type 12 and others.

[0055] Option F.

[0056] An option to indicate that nested complex data types 12 can beprinted with the current-complex data type 12 being printed or forindicating that the nested complex data type 12 are not to be printed.

[0057] Option G.

[0058] This option includes placing the full scope of each complex datatype 12 in the return buffer. The scope can be defined by the sourcefilename, function or method name and possibly a local scope definition,such as a static section.

[0059] Option H.

[0060] This option causes the return buffer to be written to the storedfile instead of being returned in memory, to the caller of the printfunction 10, in an in-memory buffer. This can reduce the truncation ofhuge or nested complex data types 12. In this case the void *buf, shownin the C/C++ example above would really be a FILE *buf (that is, thepointer to the file). The caller is responsible for opening/closing thefile. Output is written to the current location within the stream or maybe appended to the end of the file.

[0061] Option I.

[0062] This option indicates that the print function 10 should returnall native int types (that is, integer types) in hexadecimal format, anexample of which is the address complex data type shown above in the“123 ANYSTREET” example.

[0063] Option /Fs[+|−]

[0064] Unlike the previous options to the print function 24, this optionis presented to the compiler 20 itself. The purpose of the option is toenable or disable the processing of the print function 24. The defaultoption is /Fs−. This option is turned off meaning that the printfunction 24 does not generate any code in the object file 22. When the/Fs+ option is specified the object file 22 is created with the printprogram logic enabled as summarized above. If the cprintf option isturned off, then a default string will replace the formatted complexdata type 12 such as “Formatted data type is not available as compileroption /Fs+ was not specified”.

[0065] Further, a call back function may be included in the front endcompiler 20 for supporting an application writer (not shown) Theapplication writer may use this call back function for registering thewriter's formatter according to specific specifications and thus thisensures the above information/requirements are met. For example, theformatter may be adapted to handle a certain complex or native data type12, say password fields, and replaces a password with asterisks beforereturning the formatted information. This call back function may returnflags which could control whether the complex data type 12 is to beprinted at all.

[0066] Parameter Slen

[0067] The slen argument sets a limit on the length of each nativestring data type that can be put into the returned buffer. For example,some strings may be 1000 or 10000 characters long. We may not want orneed all that information. The first 100 characters may be enough. Thisoption allows for that restriction.

[0068] Another embodiment of the invention provides the compiler 20having another internal function, which is called max size:

[0069] size_t cgetmaxsize(_ctype_val, int opts, int slen)

[0070] This internal function determines the maximum size of thereturned buffer for formatting the complex data type 12. The maxsizefunction can be used to determine the amount of space needed to be ableto contain the fully formatted complex data type 12. Since the complexdata type 12 is known by the compiler 20 at compile time, the compiler20 front end may turn this into a compile time constant.

[0071] Using the C/C++ example above, the compiler 20 creates a versionof print function 10, cprintf as function 24, for the type val thatwould include the scope of val (i.e. file name, or other). It should benoted that the scope was defined above under option G.

[0072] Referring again to FIG. 1, a linker 26 provides a linkage phasefor creating an executable or shared library 28, which would collapseany duplicate executable print functions 30 into one instance of theprint function 24, thus eliminating any duplicate print functions. Itshould be noted that complex data types 12 that have the same name butdifferent type and scope would not collapse into the single printfunction 30 but would remain unique due to the different scope and type.The resulting executable or shared library 28 contains one copy of theexecutable print function 30 for every type that used an instance ofcprintf function 24.

[0073] Referring to FIG. 2, the compiler 20 contains a number of modules40 for creating the object print command 24. An identifier module 41recognises the cprintf functions 10 in the source code 14 duringcompilation. A type module 42 identifies the complex data type 12contained in the recognized print commands 10 from a user-defined numberof data types known to the compiler 20. A format module 44 operates onthe settings of the print command 10 that determine how to display orotherwise format the complex data type 12, as initially specified by thedeveloper of the code 14. The compiler 20 can also have a settingsmodule 46 for compiling any optional flag settings. The compiler alsohas an object file generator module 48 for assembling an object filecontaining the embedded compiled print command 24 with associated code34.

[0074] Referring to FIG. 3, the linker 26 contains a number of modules50 for creating the executable commands 30. An identifier module 51recognises all object files 22 and searches for the embedded objectprint commands 24. A compare module 52 compares each identified printcommands 24 for identical instances of the commands 24. The linker 26also has a deletion module 54 for code optimisation purposes, whichdeletes all identical copies of each print command 24 instance save one,while a reference module 56 references the remaining instance of thecommand 24 to the locations of the deleted commands 24, thus providing alibrary function 28 containing the remaining instance of the nowexecutable commands 30. The linker 26 also has a generator module 58 forgenerating the executable file 16 containing the executable printcommands 30 for each executable modules A, B. It should be noted thatthese modules A, B may not be executable, rather they may be combinedinto one executable module, or may be such as but not limited toseparate modules A, B depending upon the linker 26 options.

[0075] Referring now to FIG. 1, in view of the above, while the compiler20 is processing the source file 14 it detects the print functions 10and thus generates in the object file 22 the program logic 34 to printthe complex data type 12 specified in the print statement 24. The linker26 uses the object file 22 to link the reference/executable commands 30from the print function 24 to the program logic 34 just created andstored in the library 28.

[0076] Referring again to FIG. 1, the linker 26 can also be used toidentify all embedded print commands 24 in the object files 22. Forexample, each of the commands 24 may be unique, and therefore each ofthe print commands 24 would be referenced by the reference module 56 tocreate a corresponding number of the executable print commands 30.Therefore, the deletion module 54 would not be used in this case whereeach of the print commands 24 are unique

[0077] The print function 24 is created in the compiler 20, as theinformation to do the job is already known by the compiler 20. Forexample, the compiler 20 knows all the data types, tracks and formatsall the structures, and knows the byte alignment. All the compiler 20does is to take this already known information and package it in theformat as described above, to produce the object command 24 as acomponent of the relatively optimized compilation of the source code 14.It should be noted that the compiler 20 is a single separate grouping ofmodules for running against the optimized code. Accordingly, thecompiler 20 is a computer front-end enhancement that helps to generateembedded print functions 24 in the object files 22 for the selected datastructures/types.

[0078] Referring again to FIG. 1, an example of the data processingsystem 100 has a memory 102 for storing the source code 14, the complier20, and the linker 26. The source code 14 consists of two pieces ormodules 32: source module A and source module B. Also stored in thememory 102 is the complex data type 12 named COMPANY, for example. Thesource code 14 (the computer program that requires debugging oranalysis) and the complex data type 12 are input to the compiler 20(that is the complier 20 reads these items). The compiler 20 thengenerates the object module A and the object module B. Each of theseobject modules 22 contain program code 34 to handle the printing of datatype 12. This is because each source module 32 can print the COMPANYcomplex data type 12.

[0079]FIG. 4 shows operations S200 the compiler 20 of FIG. 1. OperationsS200 are for embedding the print command 24 (for printing the complexdata type 12) into the object code 22 (see FIG. 1). Operation S202includes starting the compiler 20 (these operations S202 to S218 areperformed for each source module 32 that was identified or read by thecomplier 20). Operation S204 includes identifying embedded cprintf cdtcommands 10 in the source modules 32. Operation S206 includes validatingparameters found in the identified cprintf command 10, including forexample the options as described above. Operation S208 includesidentifying the complex data type 12 identified in the cprintf command10 (a parameter in the cprintf identifies the complex data type 12selected from a set of user-defined data types 12 known to the compiler20). Operation S210 includes executing the cprintf flag settings thatidentify how to output or otherwise print the selected complex data type12. Operation S212 includes executing any optional flag settings thatidentify how to process the data contained in the complex data type 12.Operation S214 includes outputting or generating the object file 22having the formatted complex data type 12 which is specified by theobject cprintf command 24. Finally, operation S216 includes completingany other compiler 20 duties or operations to complete the object file22, with operation S218 including ending operations of the compiler 20.

[0080] Once the compiler 20 has completed the operation for producingthe object file 22 that corresponds to the source modules 32, then thelinker 26 operates to generate the executable file 16 (see FIG. 1).Referring now to FIG. 5, there is depicted operation S300 of the linker26 of FIG. 1. In summary, the linker 26 takes in all the object modulesor components 22 and looks for duplicate sections of code for the printcommand 24 of each complex data type 12. In this example, the linker 26sees that both object module A and object module B print the sameCOMPANY complex data type 12. As they both print the same one, they canuse the same executable print code 30 to print that complex data type12, and thus one of the object modules code 34 to handle the printcommand 30 can be removed and replaced with a much smaller set of codethat simply tells the object module to use the reaming print code 28stored for example in the library.

[0081] Operation S302 includes starting the operation of the linker 26.Operation S304 includes identifying all object files 22. Operation S306includes searching for cprintf commands 24 embedded in the object files22. Operation S308 includes comparing each identified cprintf command 24for identical instances. Operation S310 includes deleting all identicalinstances except for one remaining instance in the library 28. OperationS312 includes chain referencing the one single remaining instance tolocations of removed identical instances of the executable cprintcommands 30 now in the executable file 16 (see FIG. 1). Operation S314includes completing any other linker 26 duties to complete theexecutable files 16. Operation S316 includes ending operations of thelinker 26.

[0082] Once the linker 26 has generated the executable code 16, theexecutable code 16 may be executed by the data processing system 100 ofFIG. 1 and the complex data type 12 may be printed by the output device18, and the source code 14 may then be debugged according to the skillsof the software developer.

[0083] Referring back to FIG. 1, an alternative embodiment provides acomputer program product (not depicted) which includes acomputer-readable medium tangibly embodying computer executableinstructions that direct the data processing system 100 to implement anycomplier 20 as previously described above. It will be appreciated thatthe computer program product may be a floppy disk, hard disk or othermedium for long term storage of the computer executable instructions.

[0084] Also, another alternative embodiment provides an article whichhas a computer-readable, signal-bearing medium, and also has means ormechanism in the medium for directing the data processing system 100 toimplement any complier 20 as previously described above. It will beappreciated that a supplier of the complier 20 may upload the article(not depicted) to a network (such as the internet) and users maydownload the article via the network to their respective data processingsystems.

[0085] It will be appreciated that another alternative embodiment mayprovides a computer program product having a computer-readable mediumthat tangibly embodies computer executable instructions for directingthe data processing system 100 to implement any linker 26 as previouslydescribed above. It will be appreciated that the computer programproduct may be a floppy disk, hard disk or other medium for long termstorage of the computer executable instructions.

[0086] Also, another embodiment provides an article that has acomputer-readable signal-bearing medium, and that also has means ormechanisms in the medium for directing the data processing system 100 toimplement any linker 26 as previously described above. It will beappreciated that a supplier of the linker 26 may upload the article to anetwork (such as the internet) and users may download the article viathe network to their respective data processing systems.

[0087] It will be appreciated that variations of some elements arepossible to adapt the invention for specific conditions or functions.The concepts of the present invention can be further extended to avariety of other applications that are clearly within the scope of thisinvention. Having thus described the present invention with respect tothe preferred embodiments as implemented, it will be apparent to thoseskilled in the art that many modifications and enhancements are possibleto the present invention without departing from the basic concepts asdescribed in the preferred embodiment of the present invention.Therefore, what is intended to be protected by way of letters patentshould be limited only by the scope of the following claims.

[0088] Furthermore, the following is an example of a C language sourcecode listing that includes the printing statement 10 as contained in thesource code 14. // define a complex data type consisting of two nativetypes and another complex data type // the native types being the int(integer) and char (character string). struct myStruct {  struct myOtherStruct embeddedStruct;   int    nativeIntegerType;  char  *pNullTerminatedString; }; // example function which determinesthe size of a buffer needed to print the above // complex data type‘myStruct’, and then prints it to an write to an in memory buffer intfoo( ) {   rc = someFunction( &myStruct );   if ( rc != 0 ) {    //determine size of buffer needed   char structBuff[cgetmaxsize( struct myStruct, CPRINTF_RECURSIVE,10)];    // print the complex data type    cprintf( structBuff, cgetmaxsize( struct myStruct,CPRINTF_RECURSIVE, 10), myStruct,  CPRTNTF_RECURSIV, 10); } // sameexample as above except write to a File stream instead of in memorybuffer. int foo( ) {   rc = someFunction( &myStruct );   if ( rc != 0) {    fprintf( fptr, “someFunction returned an error %d withstructure:\n\n”, rc );    cprintf( fptr, myStruct, 0, CPRINTF_RECURSIV,10);   } }

The embodiments of the invention in which an exclusive property orprivilege is claimed are defined as follows:
 1. A compiler for compilingsource code into object code, the source code including a print command,the print command for abstracted printing of a complex data structureaccessible by the compiler, the object code including code for directinga data processing system to print the complex data structure, thecompiler comprising: an identifier module for recognizing the printcommand in the source code; a type module for identifying the complexdata structure of the print command from a set of user-defined datatypes; and a format module for formatting output settings of the complexdata structure, the output settings dependent upon at least one printparameter associated with the print command; wherein the results of themodules are adapted to define the object code with an embedded printcommand.
 2. The compiler of claim 1 further comprising: a generatormodule for creating the object code with the embedded print commandcontaining the formatted output settings for the complex data structure;and wherein the data processing system uses an executable version of theembedded print command to print the complex data structure to an outputdevice.
 3. The compiler of claim 2 further comprising a settings modulefor including at least one optional flag setting of the print command inthe output settings.
 4. The compiler of claim 3, wherein the flagsetting provides for a default return buffer.
 5. The compiler of claim4, wherein the return buffer is adapted to contain a pointer to an areaof memory of the data processing system.
 6. The compiler of claim 4,wherein the flag setting provides for a size of each field in thecomplex data structure.
 7. The compiler of claim 4, wherein the flagsetting further includes a pad for aligning the fields of the complexdata structure.
 8. The compiler of claim 3, wherein the flag settingprovides for printing of nested ones of the complex data structure. 9.The compiler of claim 8, wherein the nested printing is adapted to bedone by a program loop in the object code.
 10. The compiler of claim 8,wherein the nested printing is adapted to be done by a recursive call ofthe embedded print function for each of the non-native structures withinthe complex data structure.
 11. The compiler of claim 4, wherein theflag setting provides for the return buffer to be written to a storedfile.
 12. The compiler of claim 3, wherein the flag setting enables ordisables the processing of the embedded print command.
 13. The compilerof claim 12, wherein when disabled, the embedded print function isadapted to replace the complex data structure to the output device witha default string.
 14. The compiler of claim 2 wherein the format modulehas a size function for determining the maximum size of a return buffer.15. The compiler of claim 2, wherein the output device is selected fromthe group including a computer display, a printer, and a stored file.16. The compiler of claim 2, wherein the object code is executable bythe data processing system.
 17. The compiler of claim 2, wherein thecomplex data structure includes arbitrary data.
 18. The compiler ofclaim 2, wherein the complex data structure includes data types selectedfrom the group comprising structures, classes, and unions.
 19. Thecompiler of claim 1, wherein the print parameter is a user-defined printparameter contained in the print command.
 20. The compiler of claim 1,wherein the print parameter is a default print parameter.
 21. A computerprogram product having a computer-readable medium tangibly embodyingcomputer readable instructions for directing a compiler operable in adata processing system to compile source code into object code, thesource code including a print command, the print command for abstractedprinting of a complex data structure accessible by the compiler, theobject code including code for directing a data processing system toprint the complex data structure, the computer program productcomprising: computer readable code for implementing an identifier modulefor recognizing the print command in the source code; computer readablecode for implementing a type module for identifying the complex datastructure of the print command from a set of user-defined data types;and computer readable code for implementing a format module forformatting output settings of the complex data structure, the outputsettings dependent upon at least one print parameter associated with theprint command; wherein the results of the modules are adapted to definethe object code with an embedded print command.
 22. The computer programproduct of claim 21 further comprising: computer readable code forimplementing a generator module for creating the object code with theembedded print command containing the formatted output settings for thecomplex data structure; and wherein the data processing system uses anexecutable version of the embedded print command to print the complexdata structure to an output device.
 23. The computer program product ofclaim 22 further comprising computer readable code for implementing asettings module for including at least one optional flag setting of theprint command in the output settings.
 24. The computer program productof claim 23, wherein the flag setting provides for a default returnbuffer.
 25. The computer program product of claim 24, wherein the returnbuffer is adapted to contain a pointer to an area of memory of the dataprocessing system.
 26. The computer program product of claim 24, whereinthe flag setting provides for a size of each field in the complex datastructure.
 27. The computer program product of claim 24, wherein theflag setting further includes a pad for aligning the fields of thecomplex data structure.
 28. The computer program product of claim 23,wherein the flag setting provides for printing of nested ones of thecomplex data structure.
 29. The computer program product of claim 28,wherein the nested printing is adapted to be done by a program loop inthe object code.
 30. The computer program product of claim 28, whereinthe nested printing is adapted to be done by a recursive call of theembedded print function for each of the non-native structures within thecomplex data structure.
 31. The computer program product of claim 24,wherein the flag setting provides for the return buffer to be written toa stored file.
 32. The computer program product of claim 23, wherein theflag setting enables or disables the processing of the embedded printcommand.
 33. The computer program product of claim 32, wherein whendisabled, the embedded print function is adapted to replace the complexdata structure to the output device with a default string.
 34. Thecomputer program product of claim 22 wherein the computer readable codefor implementing the format module has a size function for determiningthe maximum size of a return buffer.
 35. The computer program product ofclaim 22, wherein the output device is selected from the group includinga computer display, a printer, and a stored file.
 36. The computerprogram product of claim 22, wherein the object code is executable bythe data processing system.
 37. The computer program product of claim22, wherein the complex data structure includes arbitrary data.
 38. Thecomputer program product of claim 22, wherein the complex data structureincludes data types selected from the group comprising structures,classes, and unions.
 39. The computer program product of claim 21,wherein the print parameter is a user-defined print parameter containedin the print command.
 40. The computer program product of claim 21,wherein the print parameter is a default print parameter.
 41. An articlecomprising: a computer-readable signal-bearing medium being uploadableand downloadable on a network; and means in the medium for directing adata processing system to execute a compiler for compiling source codeinto object code, the source code including a print command, the printcommand for abstracted printing of a complex data structure accessibleby the compiler, the object code including code for directing a dataprocessing system to print the complex data structure, the means in themedium including: means in the medium for implementing an identifiermodule for recognizing the print command in the source code; and meansin the medium for implementing a type module for identifying the complexdata structure of the print command from a set of user-defined datatypes; means in the medium for implementing a format module forformatting output settings of the complex data structure, the outputsettings dependent upon at least one print parameter associated with theprint command; wherein the results of the modules are adapted to definethe object code with an embedded print command.
 42. The article of claim41 further comprising: means in the medium for implementing a generatormodule for creating the object code with the embedded print commandcontaining the formatted output settings for the complex data structure;and wherein the data processing system uses an executable version of theembedded print command to print the complex data structure to an outputdevice.
 43. The article of claim 42 further comprising means in themedium for implementing a settings module for including at least oneoptional flag setting of the print command in the output settings. 44.The article of claim 43, wherein the flag setting provides for a defaultreturn buffer.
 45. The article of claim 44, wherein the return buffer isadapted to contain a pointer to an area of memory of the data processingsystem.
 46. The article of claim 44, wherein the flag setting providesfor a size of each field in the complex data structure.
 47. The articleof claim 44, wherein the flag setting further includes a pad foraligning the fields of the complex data structure.
 48. The article ofclaim 43, wherein the flag setting provides for printing of nested onesof the complex data structure.
 49. The article of claim 48, wherein thenested printing is adapted to be done by a program loop in the objectcode.
 50. The article of claim 48, wherein the nested printing isadapted to be done by a recursive call of the embedded print functionfor each of the non-native structures within the complex data structure.51. The article of claim 44, wherein the flag setting provides for thereturn buffer to be written to a stored file.
 52. The article of claim43, wherein the flag setting enables or disables the processing of theembedded print command.
 53. The article of claim 52, wherein whendisabled, the embedded print function is adapted to replace the complexdata structure to the output device with a default string.
 54. Thearticle of claim 42 wherein the means in the medium for implementing theformat module has a size function for determining the maximum size of areturn buffer.
 55. The article of claim 42, wherein the output device isselected from the group including a computer display, a printer, and astored file.
 56. The article of claim 42, wherein the object code isexecutable by the data processing system.
 57. The article of claim 42,wherein the complex data structure includes arbitrary data.
 58. Thearticle of claim 42, wherein the complex data structure includes datatypes selected from the group comprising structures, classes, andunions.
 59. The article of claim 41, wherein the print parameter is auser-defined print parameter contained in the print command.
 60. Thearticle of claim 41, wherein the print parameter is a default printparameter.
 61. A linker for linking components of an object code toproduce an executable code, some components of the object code adaptedto have an individual copy of a printing object for printing a complexdata structure, the linker comprising: an identifier module forrecognizing at least one of the object components having an embeddedprint command corresponding to the individual printing object, theembedded print command for abstracted printing of the complex datastructure; and a compare module for comparing two or more identifiedembedded print commands from the object components, the comparison fordetermining whether two or more of the identified embedded printcommands are identical copies of the individual printing object; whereinthe results of the modules are adapted to define the executable codewith at least one executable print command corresponding to the embeddedprint command.
 62. The linker of claim 61, wherein the identifier modulefor recognizing at least two embedded print commands in the objectcomponents and the linker further includes: a deletion module forreducing the number of identical copies of the individual printingobjects in the embedded print commands and for retaining at least onesharable copy; and a reference module for referencing the embedded printcommands to the one shared copy of the printing object to createcorresponding executable print commands.
 63. The linker of claim 61further comprising a generator module for generating the executable codecontaining the executable print command; and wherein the executable codedirects a data processing system to print the complex data structurecorresponding to the executable print command.
 64. The linker of claim62 further comprising: a generator module for generating the executablecode containing at least two of the executable print commands, theexecutable print commands linked to the shared printing object; andwherein the executable code directs a data processing system to printthe same complex data structure corresponding to the shared printingobject.
 65. The linker according to claim 64 further comprising a sharedlibrary for containing code corresponding to the shared printing object.66. The linker according to claim 64, wherein the shared printing objectrepresents one executable copy of the executable print command for everytype using an instance of the embedded print command.
 67. The linkeraccording to claim 64, wherein the code of the shared printing objectcontains formatted output settings for the complex data structure. 68.The linker according to claim 67, wherein the output settings aredependent upon at least one print parameter of the embedded printcommand.
 69. The linker according to claim 64, wherein the dataprocessing system is adapted to use the executable print command toprint the complex data structure to an output device.
 70. The linkeraccording to claim 69, wherein the output device is selected from thegroup comprising a computer display, a printer, and a stored file. 71.The linker according to claim 64, wherein the complex data structureincludes arbitrary data.
 72. The linker according to claim 64, whereinthe complex data structure includes data types selected from the groupcomprising structures, classes, and unions.
 73. A computer programproduct having a computer-readable medium tangibly embodying computerreadable code for directing a data processing system to implement alinker for linking components of an object code to produce an executablecode, some components of the object code adapted to have an individualcopy of a printing object for printing a complex data structure, thecomputer program product comprising: computer readable code forimplementing an identifier module for recognizing at least one of theobject components having an embedded print command corresponding to theindividual printing object, the embedded print command for abstractedprinting of the complex data structure; and computer readable code forimplementing a compare module for comparing two or more identifiedembedded print commands from the object components, the comparison fordetermining whether two or more of the identified embedded printcommands are identical copies of the individual printing object; whereinthe results of the modules are adapted to define the executable codewith at least one executable print command corresponding to the embeddedprint command.
 74. The computer program product of claim 73, wherein thecomputer readable code for implementing the identifier module forrecognizing at least two embedded print commands in the objectcomponents and the linker further includes: computer readable code forimplementing a deletion module for reducing the number of identicalcopies of the individual printing objects in the embedded print commandsand for retaining at least one sharable copy; and computer readable codefor implementing a reference module for referencing the embedded printcommands to the one shared copy of the printing object to createcorresponding executable print commands.
 75. The computer programproduct of claim 73 further comprising computer readable code forimplementing a generator module for generating the executable codecontaining the executable print command; and wherein the executable codedirects a data processing system to print the complex data structurecorresponding to the executable print command.
 76. The computer programproduct of claim 74 further comprising: computer readable code forimplementing a generator module for generating the executable codecontaining at least two of the executable print commands, the executableprint commands linked to the shared printing object; and wherein theexecutable code directs a data processing system to print the samecomplex data structure corresponding to the shared printing object. 77.The computer program product according to claim 76 further comprisingcomputer readable code for implementing a shared library for containingcode corresponding to the shared printing object.
 78. The computerprogram product according to claim 76, wherein the shared printingobject represents one executable copy of the executable print commandfor every type using an instance of the embedded print command.
 79. Thecomputer program product according to claim 76, wherein the code of theshared printing object contains formatted output settings for thecomplex data structure.
 80. The computer program product according toclaim 79, wherein the output settings are dependent upon at least oneprint parameter of the embedded print command.
 81. The computer programproduct according to claim 76, wherein the data processing system isadapted to use the executable print command to print the complex datastructure to an output device.
 82. The computer program productaccording to claim 81, wherein the output device is selected from thegroup comprising a computer display, a printer, and a stored file. 83.The computer program product according to claim 76, wherein the complexdata structure includes arbitrary data.
 84. The computer program productaccording to claim 76, wherein the complex data structure includes datatypes selected from the group comprising structures, classes, andunions.
 85. An article comprising: a computer-readable signal-bearingmedium being uploadable and downloadable on a network; and means in themedium for directing a data processing system to implement a linker forlinking components of an object code to produce an executable code, somecomponents of the object code adapted to have an individual copy of aprinting object for printing a complex data structure, the means in themedium including: means in the medium for implementing an identifiermodule for recognizing at least one of the object components having anembedded print command corresponding to the individual printing object,the embedded print command for abstracted printing of the complex datastructure; and means in the medium for implementing a compare module forcomparing two or more identified embedded print commands from the objectcomponents, the comparison for determining whether two or more of theidentified embedded print commands are identical copies of theindividual printing object; wherein the results of the modules areadapted to define the executable code with at least one executable printcommand corresponding to the embedded print command.
 86. The article ofclaim 85, wherein the means in the medium for implementing theidentifier module for recognizing at least two embedded print commandsin the object components and the linker further includes: means in themedium for implementing a deletion module for reducing the number ofidentical copies of the individual printing objects in the embeddedprint commands and for retaining at least one sharable copy; and meansin the medium for implementing a reference module for referencing theembedded print commands to the one shared copy of the printing object tocreate corresponding executable print commands.
 87. The article of claim85 further comprising means in the medium for implementing a generatormodule for generating the executable code containing the executableprint command; and wherein the executable code directs a data processingsystem to print the complex data structure corresponding to theexecutable print command.
 88. The article of claim 86 furthercomprising: means in the medium for implementing a generator module forgenerating the executable code containing at least two of the executableprint commands, the executable print commands linked to the sharedprinting object; and wherein the executable code directs a dataprocessing system to print the same complex data structure correspondingto the shared printing object.
 89. The article according to claim 88further comprising means in the medium for implementing a shared libraryfor containing code corresponding to the shared printing object.
 90. Thearticle according to claim 88, wherein the shared printing objectrepresents one executable copy of the executable print command for everytype using an instance of the embedded print command.
 91. The articleaccording to claim 88, wherein the code of the shared printing objectcontains formatted output settings for the complex data structure. 92.The article according to claim 91, wherein the output settings aredependent upon at least one print parameter of the embedded printcommand.
 93. The article according to claim 88, wherein the dataprocessing system is adapted to use the executable print command toprint the complex data structure to an output device.
 94. The articleaccording to claim 93, wherein the output device is selected from thegroup comprising a computer display, a printer, and a stored file. 95.The article according to claim 88, wherein the complex data structureincludes arbitrary data.
 96. The article according to claim 88, whereinthe complex data structure includes data types selected from the groupcomprising structures, classes, and unions.
 97. A computer programproduct having a medium tangibly embodying computer readable code forimplementing a print function for directing a compiler to generate anembedded print command in an object code for directing a data processingsystem to print a complex data structure identified by the printfunction, the print function for use in source code, the computerprogram product comprising: computer readable code for implementing abuffer parameter for identifying the buffer to receive the complex datastructure selected from a set of user-defined data types; computerreadable code for implementing a size parameter for limiting the size ofthe buffer; computer readable code for implementing a type parameterthat is internal to the compiler, the type parameter for acceptingcomplex data types corresponding to the complex data structure; andcomputer readable code for implementing an output parameter forrepresenting the output settings of the complex data structure; whereinan executable version of the embedded print command is used by the dataprocessing system for abstracted printing of the complex data structure.98. The computer program product of claim 97 further comprising at leastone optional flag setting for affecting the output settings.
 99. Thecomputer program product of claim 98, wherein the flag setting providesfor a default return buffer.
 100. The computer program product of claim99, wherein the return buffer is adapted to contain a pointer to an areaof memory of the data processing system.
 101. The computer programproduct of claim 99, wherein the flag setting provides for a size ofeach field in the complex data structure.
 102. The computer programproduct of claim 99, wherein the flag setting further includes a pad foraligning the fields of the complex data structure.
 103. The computerprogram product of claim 98, wherein the flag setting provides forprinting of nested ones of the complex data structure.
 104. The computerprogram product of claim 103, wherein the nested printing is adapted tobe done by a program loop in the object code.
 105. The computer programproduct of claim 103, wherein the nested printing is adapted to be doneby a recursive call of the embedded print function for each of thenon-native structures within the complex data structure.
 106. Thecomputer program product of claim 98, wherein the flag setting providesfor the return buffer to be written to a stored file.
 107. The computerprogram product of claim 98, wherein the flag setting enables ordisables the processing of the embedded print command.
 108. The computerprogram product of claim 107, wherein when disabled, the embedded printfunction is adapted to replace the complex data structure to an outputdevice with a default string.
 109. The computer program product of claim97 further comprising computer readable code for implementing a sizefunction for determining the maximum size of a return buffer.
 110. Anarticle comprising: a computer-readable signal-bearing medium beinguploadable and downloadable over a network; and means in the medium fordirecting a data processing system to implement a print function fordirecting a compiler to generate an embedded print command in an objectcode for directing a data processing system to print a complex datastructure identified by the print function, the print function for usein source code, the means in the medium including: means in the mediumfor implementing a buffer parameter for identifying the buffer toreceive the complex data structure selected from a set of user-defineddata types; means in the medium for implementing a size parameter forlimiting the size of the buffer; means in the medium for implementing atype parameter that is internal to the compiler, the type parameter foraccepting complex data types corresponding to the complex datastructure; and means in the medium for implementing an output parameterfor representing the output settings of the complex data structure;wherein an executable version of the embedded print command is used bythe data processing system for abstracted printing of the complex datastructure.
 111. The article of claim 110 further comprising at least oneoptional flag setting for affecting the output settings.
 112. Thearticle of claim 111, wherein the flag setting provides for a defaultreturn buffer.
 113. The article of claim 112, wherein the return bufferis adapted to contain a pointer to an area of memory of the dataprocessing system.
 114. The article of claim 112, wherein the flagsetting provides for a size of each field in the complex data structure.115. The article of claim 112, wherein the flag setting further includesa pad for aligning the fields of the complex data structure.
 116. Thearticle of claim 111, wherein the flag setting provides for printing ofnested ones of the complex data structure.
 117. The article of claim116, wherein the nested printing is adapted to be done by a program loopin the object code.
 118. The article of claim 116, wherein the nestedprinting is adapted to be done by a recursive call of the embedded printfunction for each of the non-native structures within the complex datastructure.
 119. The article of claim 112, wherein the flag settingprovides for the return buffer to be written to a stored file.
 120. Thearticle of claim 111, wherein the flag setting enables or disables theprocessing of the embedded print command.
 121. The article of claim 120,wherein when disabled, the embedded print function is adapted to replacethe complex data structure to an output device with a default string.122. The article of claim 110 further comprising means in the medium forimplementing a size function for determining the maximum size of areturn buffer.